package com.xps.and.yuntong.Data.net;


import com.xps.and.yuntong.Data.bean1.AlipayBean;
import com.xps.and.yuntong.Data.bean1.ArrivedDestination;
import com.xps.and.yuntong.Data.bean1.ArrivedParking;
import com.xps.and.yuntong.Data.bean1.ConfirmSettlement;
import com.xps.and.yuntong.Data.bean1.Departure;
import com.xps.and.yuntong.Data.bean1.FaceDetection;
import com.xps.and.yuntong.Data.bean1.FaceSign;
import com.xps.and.yuntong.Data.bean1.LoginBean;
import com.xps.and.yuntong.Data.bean1.OrderDetail;
import com.xps.and.yuntong.Data.bean1.OrderDriver;
import com.xps.and.yuntong.Data.bean1.OrderList;
import com.xps.and.yuntong.Data.bean1.OrderSettlement;
import com.xps.and.yuntong.Data.bean1.Resetpwd;
import com.xps.and.yuntong.Data.bean1.ShortBean;
import com.xps.and.yuntong.Data.bean1.ShortVerification;
import com.xps.and.yuntong.Data.bean1.StartTrip;
import com.xps.and.yuntong.Data.bean1.SubmitJpush;
import com.xps.and.yuntong.Data.bean1.doRegister;
import com.xps.and.yuntong.Data.serviceapi.UserApi;


import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;


public class UserNetWorks extends RetrofitUtils {

    protected static final UserApi UserApi = RetrofitUtils.getUserApi();

    protected static final UserApi UserApiYt = RetrofitUtils.getUserApiYt();

    protected static final UserApi UserGXApi = RetrofitUtils.getPayApiGX();

    /*
    *发送短信验证码接口
    * */
    public static void getShort(String phoneNum, String smsCode, String smsSign, Subscriber<ShortBean> observer) {
        UserApiYt.getShort(phoneNum, smsCode, smsSign).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *验证短信验证码接口
     * */
    public static void getShortVerification(String phoneNum, String smsCode, String smsVerifyCode, Subscriber<ShortVerification> observer) {
        UserApiYt.getShortVerification(phoneNum, smsCode, smsVerifyCode).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *重置登录密码
     * */
    public static void resetpwd(String mobile_phone, String sms_code, String new_pwd, Subscriber<Resetpwd> observer) {
        UserApiYt.resetpwd(mobile_phone, sms_code, new_pwd).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *司机注册
     * */
    public static void getRegister(String name, String mobile_phone, String password, String head_img, String photo_url, String idcard_id, String idcard_up, String idcard_down, String driver_license, String driving_license, String operating_permit, String car_id, String car_color, String car_type, String car_photo, String driver_age, Subscriber<doRegister> observer) {
        UserApiYt.getRegister(name, mobile_phone, password, head_img, photo_url, idcard_id, idcard_up, idcard_down, driver_license, driving_license, operating_permit, car_id, car_color, car_type, car_photo, driver_age).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *人脸检测
     * */
    public static void FaceDetection(String photo_url, Subscriber<FaceDetection> observer) {
        UserApiYt.FaceDetection(photo_url).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *统一登录接口
     * */
    public static void getLoginYt(String mobile_phone, String password, String client_type, String sms_code, Subscriber<LoginBean> observer) {
        UserApiYt.getLoginYt(mobile_phone, password, client_type, sms_code).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *司机查询当前有无订单
     * */
    public static void getOrederDiver(String aaa, Subscriber<OrderDriver> observer) {
        UserApiYt.getOrederDiver(aaa).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /*
     *人脸认证
     * */
    public static void getFaceSign(String photo_url, Subscriber<FaceSign> observer) {
        UserApiYt.FaceSign(photo_url).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @param reg_id
     * @param device_type 添加/更新极光ID及设备型号
     * @param observer
     */
    public static void SubmitJpush(String reg_id, String device_type, Subscriber<SubmitJpush> observer) {
        UserApiYt.submitJpush(reg_id, device_type).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    /**
     * @param开始行程
     */
    public static void startTrip(String order_id, Subscriber<StartTrip> observer) {
        UserApiYt.startTrip(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @param到达上车点==我已到达
     */
    public static void arrivedParking(String order_id, Subscriber<ArrivedParking> observer) {
        UserApiYt.arrivedParking(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @param立即出发==开始出发
     */
    public static void departure(String order_id, Subscriber<Departure> observer) {
        UserApiYt.departure(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @param确认送达
     */
    public static void destination(String order_id, Subscriber<ArrivedDestination> observer) {
        UserApiYt.destination(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @param司机订单结算
     */
    public static void orderSettlement(String order_id, Subscriber<OrderSettlement> observer) {
        UserApiYt.orderSettlement(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @param司机确认结算
     */
    public static void confirmSettlement(String order_id, Subscriber<ConfirmSettlement> observer) {
        UserApiYt.confirmSettlement(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @司机订单列表
     */
    public static void orderList(String page_size, String page_index, Subscriber<OrderList> observer) {
        UserApiYt.orderList(page_size, page_index).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    /**
     * @订单详情
     */
    public static void orderDetail(String order_id, Subscriber<OrderDetail> observer) {
        UserApiYt.orderDetail(order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    /**
     * @订单详情
     */
    public static void getAlipay(String amount, Subscriber<AlipayBean> observer) {
        UserApiYt.getAlipay(amount).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }



}
